package kr.co.goodwilldd.entity.restful.model;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import kr.co.goodwilldd.entity.menus.model.MenuEntity;

import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.map.annotate.JsonSerialize;

@XmlRootElement(name = "result")
@XmlType(name = "Result", namespace = "kr.co.goodwilldd.entity.restful.model.RestEntity", propOrder = {
		"result", "code", "datas" })
@JsonAutoDetect
@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
public class RestEntity<T> {
	String result;
	String code;
	List<T> datas;

	public String getResult() {
		return result;
	}

	public String getCode() {
		return code;
	}

	public List<T> getDatas() {
		return datas;
	}

	@XmlElement(name="result")
	public void setResult(String result) {
		this.result = result;
	}

	@XmlElement(name="code")
	public void setCode(String code) {
		this.code = code;
	}

	@XmlElementWrapper(name="datas")
	@XmlElementRefs({
		@XmlElementRef(name="data", type=ChildEntity.class),
		@XmlElementRef(name="data", type=MenuEntity.class)
	})
	public void setDatas(List<T> datas) {
		this.datas = datas;
	}

}
